package com.gopay.common.cps.dao.cbrmb.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.cps.dao.cbrmb.CbRmbIntlCardWaybillDAO;
import com.gopay.common.domain.cbrmb.internationalcard.IntlCardWaybill;

/**
 * 跨境人民币 外卡运单表DAO实现类
 * @CbRmbIntlCardWaybillDAOImpl.java
 * @author lailingyu
 * @2018-2-13 下午3:12:03  www.gopay.com.cn Inc.All rights reserved.
 */
@Repository(value = "cbRmbIntlCardWaybillDAO")
public class CbRmbIntlCardWaybillDAOImpl extends BaseDAOImpl<IntlCardWaybill, Integer> implements CbRmbIntlCardWaybillDAO {

	@Override
	public IntlCardWaybill findSuccessByMerOrderId(String merOrderId) {
		String hql = "from IntlCardWaybill where merOrderId =:merOrderId and isSuccess = '0'";
		Map<String, Object> param = new HashMap<>(1);
		param.put("merOrderId", merOrderId);
		List<IntlCardWaybill> list = findByHql(hql, param);
		if (list != null && list.size() > 0) {
			return list.get(0);
		} else {
			return null;
		}
	}

}
